package code.tools.commponents
{
	import code.structure.manager.font.FontManager;
	import code.structure.manager.language.LanguageManager;
	
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;

	/**
	 *原价信息 
	 * @author liangqian
	 * 
	 */	
	public class OriginalInfo
	{
		/** 折扣----原跳过所有价格 */
		private var _skipAllPriceArea:Sprite;
		private var _originalText:TextField;
		private var _originalValueText:TextField;
		private var _redLine:Sprite;
		public function OriginalInfo(area:Sprite, desc:String, fontSize:int = 12,color:uint = 0x544510)
		{
			/** 折扣----原跳过所有价格 */
			_skipAllPriceArea = area;
			_originalText = Helpers.processTf(_skipAllPriceArea,'originalText',desc,FontManager.getInstance().embeddedFontCName);
			//_originalValueText = Helpers.processTf(_skipAllPriceArea,'originalPrice_text1','',FontManager.getInstance().embeddedFonDName);
			_originalValueText = Helpers.FormatTextField(_skipAllPriceArea,_originalText.x + _originalText.textWidth + 5,0,100,TextFieldAutoSize.LEFT,color,FontManager.getInstance().embeddedFontCName,fontSize);
			_originalValueText.multiline = _originalValueText.wordWrap = false;
			_originalValueText.mouseEnabled = false;
			_redLine = _skipAllPriceArea.getChildByName('redLine')as Sprite;
			_redLine.x = _originalValueText.x;
			setInfo();
		}
		
		public function setInfo(originalValue:int = -1):void
		{
			if(originalValue < 1)
				_skipAllPriceArea.visible = false;
			else
			{
				_skipAllPriceArea.visible = true;
				_originalValueText.text = originalValue + '';
				_redLine.width =_originalValueText.textWidth + 6;
			}
		}
		
		public function get wid():int
		{
			return _skipAllPriceArea.width;
		}
		
		public function get area():Sprite
		{
			return _skipAllPriceArea;
		}
	}
}